exif: Add support for GPSTimeStamp. Generate reference data.
authoroliskoli <oliskoli>
Fri, 25 Apr 2008 18:37:27 +0000 (18:37 +0000)
committeroliskoli <oliskoli>
Fri, 25 Apr 2008 18:37:27 +0000 (18:37 +0000)
exif.c
reference/IMG_2065.JPG
reference/exif-dat.csv

diff --git a/exif.c b/exif.c
index 3b386a59dcedca4c9e82f3175cfeb82c4a943ef9..f0599b4c599637b0731e48a4c9d0b90714a579af 100644 (file)
--- a/exif.c
+++ b/exif.c
@@ -29,6 +29,8 @@
 
 #define MYNAME "exif"
 
+#define UNKNOWN_TIMESTAMP 999999999
+
 typedef struct exif_tag_s {
        gbuint16 tag;
        gbuint16 type;
@@ -388,7 +390,7 @@ exif_read(void)
                        if (! next_ifd) continue;       /* No IFD0 ? */
                        
                        ifd = gps_ifd = exif_ifd = 0;
-                       timestamp = (SECONDS_PER_DAY * 99);
+                       timestamp = UNKNOWN_TIMESTAMP;
 
                        /* we need the wpt not only during GPS IFD */
                        wpt = waypt_new();
@@ -415,11 +417,15 @@ exif_read(void)
                        
                        if (! wpt) return;
                        
-#if 0
-                       if (timestamp != (SECONDS_PER_DAY * 99)) {
-                               // wpt->creation_time = timestamp;
+                       if (wpt->creation_time && (timestamp != UNKNOWN_TIMESTAMP)) {
+                               struct tm tm;
+                               tm = *gmtime(&wpt->creation_time);
+                               tm.tm_hour = 0;
+                               tm.tm_min = 0;
+                               tm.tm_sec = 0;
+                               wpt->creation_time = mkgmtime(&tm) + timestamp;
                        }
-#endif
+
                        if (opt_filename) {
                                char *c, *cx;
                                char *str = xstrdup(fin->name);
@@ -435,6 +441,7 @@ exif_read(void)
                                xfree(str);
                        }
                        waypt_add(wpt);
+                       
                        return;
                }
        }
@@ -479,4 +486,5 @@ ff_vecs_t exif_vecs = {
        exif_args,
        CET_CHARSET_ASCII, 0
 };
+
 /**************************************************************************/
index 82da7182a672664e193c3543d63e453c60a9cfdf..0578f1f13c68fb07276eba72e294c49f64c49c5c 100644 (file)
Binary files a/reference/IMG_2065.JPG and b/reference/IMG_2065.JPG differ
index 6d8c9399890b2b901e1850e2fda90621e7ca9b01..47edcdbbeeb9f77011d0bfdfd76096c268269698 100644 (file)
@@ -1,2 +1,2 @@
 No,Latitude,Longitude,Name,Speed,Satellites,Date,Time\r
-1,44.315150,15.265690,"IMG_2065",0.0,4,2006/05/21,17:46:57\r
+1,44.315150,15.265690,"IMG_2065",0.0,4,2006/05/21,20:46:58\r